﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entity;
using IDAL;
using DALFactory;

namespace BLL
{
    /// <summary>
    /// UserRemark 业务逻辑层
    /// </summary>
    public class UserRemarkBLL
    {
        // Get an instance of the UserRemarkDAL using the DALFactory
        // Making this static will cache the DAL instance after the initial load
        private static readonly IUserRemarkDAL _dal = DataAccess.CreateUserRemark();

        /// <summary>
        /// 添加一条用户备注
        /// </summary>
        /// <param name="model">用户备注实体</param>
        /// <returns>操作是否成功</returns>
        public bool Add(UserRemark model)
        {
            return _dal.Insert(model);
        }

        /// <summary>
        /// 删除一条用户备注
        /// </summary>
        /// <param name="id">用户备注的记录ID</param>
        /// <returns>操作是否成功</returns>
        public bool Remove(int id)
        {
            return _dal.Delete(id);
        }

        /// <summary>
        /// 修改用户备注
        /// </summary>
        /// <param name="model">用户备注实体</param>
        /// <returns>操作是否成功</returns>
        public bool Modify(UserRemark model)
        {
            return _dal.Update(model);
        }

        /// <summary>
        /// 获取一条用户备注信息
        /// </summary>
        /// <param name="id">用户备注的记录ID</param>
        /// <returns>用户备注实体</returns>
        public UserRemark GetById(int id)
        {
            return _dal.GetById(id);
        }

        /// <summary>
        /// 获取用户备注分页列表
        /// </summary>
        /// <param name="pageIndex">索引页</param>
        /// <param name="pageSize">每页显示条数</param>
        /// <param name="total">总记录数</param>
        /// <returns>用户备注实体类集合</returns>
        public IList<UserRemark> GetPagingList(int pageIndex, int pageSize, out int total)
        {
            return _dal.GetPagingList(pageIndex, pageSize, out total);
        }
    }
}
